﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime;
using System.Runtime.InteropServices;
using System.Threading;

using PickGold.Callers;
using PickGold.Handler;

namespace PickGold.Arguments
{
	/// <summary>
	/// 异步操作简单事件参数
	/// </summary>
	[Serializable]
	[ComVisible(true)]
	[ClassInterface(ClassInterfaceType.AutoDispatch)]
	public class AsyncSimpleEventArgs : EventArgs, IAsyncResult
	{
		private object _Data;

		#region IAsyncResult

		object IAsyncResult.AsyncState
		{
			get
			{
				return this.AsyncState;
			}
		}

		WaitHandle IAsyncResult.AsyncWaitHandle
		{
			get
			{
				return this.AsyncWaitHandle;
			}
		}

		bool IAsyncResult.CompletedSynchronously
		{
			get
			{
				return this.CompletedSynchronously;
			}
		}

		bool IAsyncResult.IsCompleted
		{
			get
			{
				return this.IsCompleted;
			}
		}

		#endregion

		/// <summary>
		/// 用户定义的对象，它限定或包含关于异步操作的信息。
		/// </summary>
		public object AsyncState;

		/// <summary>
		/// 用于等待异步操作完成的 System.Threading.WaitHandle。
		/// </summary>
		public WaitHandle AsyncWaitHandle;

		/// <summary>
		/// 如果异步操作同步完成，则为 true；否则为 false。
		/// </summary>
		public bool CompletedSynchronously;

		/// <summary>
		/// 如果操作完成则为 true，否则为 false。
		/// </summary>
		public bool IsCompleted;

		/// <summary>
		/// 获取或设置附加数据
		/// </summary>
		public object Data
		{
			set
			{
				this._Data = value;
			}
			get
			{
				return this._Data;
			}
		}
	}
}
